package MF1DSolver;

import java.util.ArrayList;

import Integration.IFunction1D;
import MeshlessShapeFunctions.JMeshlessInterpolationFunction1D;
import MeshlessShapeFunctions.JMeshlessInterpolationFunction1D2;

public class MFResult implements IFunction1D{
	protected double[] res;
    ArrayList<JMeshlessInterpolationFunction1D> MeshlessShapeList;
    
    public MFResult(double res[], ArrayList<JMeshlessInterpolationFunction1D> MeshlessShapeList) {
		this.MeshlessShapeList = MeshlessShapeList;
		this.res = res;
	}
    
	@Override
	public double calculate(double x) {
		double tmp = 0.0;
        for (int j = 0; j <MeshlessShapeList.size(); j++) {
            tmp+= MeshlessShapeList.get(j).calculate(x)*res[j];
        }
        return tmp;
	}

	@Override
	public double calculateDerivaty(double x) {
		double tmp = 0.0;
        for (int j = 0; j <MeshlessShapeList.size(); j++) {
            tmp+= MeshlessShapeList.get(j).calculateDerivaty(x)*res[j];
        }
        return tmp;
	}

}
